import java.util.Scanner;

public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int min = Integer.MAX_VALUE;
            int n = sc.nextInt();
            //从这个数的二分之一位置开始
            for(int i = n/2; i > 2;  i--){
                if(isPrime(i) && isPrime(n-i)){
                    if(n-i-i < min){
                        min = n-i-i;
                    }
                } 
            }
            System.out.println((n-min)/2);
            System.out.println(n-(n-min)/2);
        }
    }
    
    
    public static boolean isPrime(int num){
        for(int i = 2; i < num; i++){
            if(num % i == 0){
                return false;
            }
        }
        return true;
    }
}